<!-- 角色表单弹窗 -->
<form id="sysrole-form" lay-filter="sysrole-form" class="layui-form model-form" style="overflow:auto; height:500px;width:90%;">
    <input name="roleId" type="hidden"/>
    				    <div class="layui-form-item">
        <label class="layui-form-label">角色名称</label>
        <div class="layui-input-block">
            <input name="roleName" placeholder="请输入角色名称" type="text" class="layui-input" maxlength="20"  id="roleName"
                   lay-verify="required" required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">备注</label>
        <div class="layui-input-block">
            <input name="remark" placeholder="请输入备注" type="text" class="layui-input" maxlength="20"  id="remark"
                   lay-verify="required" required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">创建者ID</label>
        <div class="layui-input-block">
            <input name="createUserId" placeholder="请输入创建者ID" type="text" class="layui-input" maxlength="20"  id="createUserId"
                   lay-verify="required" required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">创建时间</label>
        <div class="layui-input-block">
            <input name="createTime" placeholder="请输入创建时间" type="text" class="layui-input" maxlength="20"  id="createTime"
                   lay-verify="required" required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">0不展示 1 展示</label>
        <div class="layui-input-block">
            <input name="type" placeholder="请输入0不展示 1 展示" type="text" class="layui-input" maxlength="20"  id="type"
                   lay-verify="required" required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">是否允许登小程 序 0 不允许 1允许</label>
        <div class="layui-input-block">
            <input name="loginXcx" placeholder="请输入是否允许登小程 序 0 不允许 1允许" type="text" class="layui-input" maxlength="20"  id="loginXcx"
                   lay-verify="required" required/>
        </div>
    </div>
     <div class="layui-form-item model-form-footer">
        <button class="layui-btn layui-btn-primary" ew-event="closeDialog" type="button">取消</button>
        <button class="layui-btn" lay-filter="user-form-submit" lay-submit>保存</button>
    </div>
</form>

<script>
    layui.use(['layer', 'admin', 'form', 'formSelects'], function () {
        var layer = layui.layer;
        var admin = layui.admin;
        var form = layui.form;
        var formSelects = layui.formSelects;
 
        var sysrole = admin.getTempData('t_sysrole');
           if (sysrole.method=="update"){
        	form.val('sysrole-form', sysrole);
            form.render();
        }
        // 表单提交事件
        form.on('submit(user-form-submit)', function (data) {
             layer.load(2);
            
            admin.req('sys/sysrole/'+sysrole.method, JSON.stringify(data.field), function (data) {
                layer.closeAll('loading');
                if (data.code == 0) {
                    layer.msg(data.msg, {icon: 1, time: 500});
                    admin.finishPopupCenter();
                } else {
                    layer.msg(data.msg, {icon: 2, time: 500});
                }
            }, "post");  
            return false;
        });
    });
</script>
